package com.itheima.controller;

import com.itheima.pojo.Account;
import com.itheima.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Date;

@RestController
@Slf4j
public class HelloController {

    @Autowired
    private DataSource dataSource;

    @Autowired
    private UserService userService;

    @GetMapping("/hello/{id}")
    public String findById(@PathVariable Integer id) throws SQLException {
        Account account = userService.findById(id);
        return "account:"+account;
    }
}
